
package cn.edu.scau.cmi.hombio.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import org.codehaus.jackson.annotate.JsonIgnore;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllCureTaskCourses", query = "select myCureTaskCourse from CureTaskCourse myCureTaskCourse"),
		@NamedQuery(name = "findCureTaskCourseById", query = "select myCureTaskCourse from CureTaskCourse myCureTaskCourse where myCureTaskCourse.id = ?1"),
		@NamedQuery(name = "findCureTaskCourseByMemo", query = "select myCureTaskCourse from CureTaskCourse myCureTaskCourse where myCureTaskCourse.memo = ?1"),
		@NamedQuery(name = "findCureTaskCourseByMemoContaining", query = "select myCureTaskCourse from CureTaskCourse myCureTaskCourse where myCureTaskCourse.memo like ?1"),
		@NamedQuery(name = "findCureTaskCourseByPrimaryKey", query = "select myCureTaskCourse from CureTaskCourse myCureTaskCourse where myCureTaskCourse.id = ?1"),
		@NamedQuery(name = "findCureTaskCourseByStep", query = "select myCureTaskCourse from CureTaskCourse myCureTaskCourse where myCureTaskCourse.step = ?1"),
		@NamedQuery(name = "findCureTaskCourseByTime", query = "select myCureTaskCourse from CureTaskCourse myCureTaskCourse where myCureTaskCourse.time = ?1") })

@Table(catalog = "pig", name = "cure_task_course")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "pigRs/cn/edu/scau/cmi/hombio/domain", name = "CureTaskCourse")
@XmlRootElement(namespace = "pigRs/cn/edu/scau/cmi/hombio/domain")
public class CureTaskCourse implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "Id", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@Id @GeneratedValue
	@XmlElement
	Integer id;
	/**
	* �Ƴ�����
	* 
	 */

	@Column(name = "Step", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Integer step;
	/**
	* Ӧ������ʱ��
	* 
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "Time", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Calendar time;
	/**
	 */

	@Column(name = "Memo")
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String memo;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "TaskId", referencedColumnName = "Id", nullable = false) })
	@XmlTransient
	Task task;
	/**
	 */
	@OneToMany(mappedBy = "cureTaskCourse", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.CureTaskMethod> cureTaskMethods;
	/**
	 */
	@OneToMany(mappedBy = "cureTaskCourse", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.CurePig> curePigs;
	/**
	 */
	@OneToMany(mappedBy = "cureTaskCourse", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.CureMethod> cureMethods;

	/**
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 */
	public Integer getId() {
		return this.id;
	}

	/**
	* �Ƴ�����
	* 
	 */
	public void setStep(Integer step) {
		this.step = step;
	}

	/**
	* �Ƴ�����
	* 
	 */
	public Integer getStep() {
		return this.step;
	}

	/**
	* Ӧ������ʱ��
	* 
	 */
	public void setTime(Calendar time) {
		this.time = time;
	}

	/**
	* Ӧ������ʱ��
	* 
	 */
	public Calendar getTime() {
		return this.time;
	}

	/**
	 */
	public void setMemo(String memo) {
		this.memo = memo;
	}

	/**
	 */
	public String getMemo() {
		return this.memo;
	}

	/**
	 */
	public void setTask(Task task) {
		this.task = task;
	}

	/**
	 */
	@JsonIgnore
	public Task getTask() {
		return task;
	}

	/**
	 */
	public void setCureTaskMethods(Set<CureTaskMethod> cureTaskMethods) {
		this.cureTaskMethods = cureTaskMethods;
	}

	/**
	 */
	@JsonIgnore
	public Set<CureTaskMethod> getCureTaskMethods() {
		if (cureTaskMethods == null) {
			cureTaskMethods = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.CureTaskMethod>();
		}
		return cureTaskMethods;
	}

	/**
	 */
	public void setCurePigs(Set<CurePig> curePigs) {
		this.curePigs = curePigs;
	}

	/**
	 */
	@JsonIgnore
	public Set<CurePig> getCurePigs() {
		if (curePigs == null) {
			curePigs = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.CurePig>();
		}
		return curePigs;
	}

	/**
	 */
	public void setCureMethods(Set<CureMethod> cureMethods) {
		this.cureMethods = cureMethods;
	}

	/**
	 */
	@JsonIgnore
	public Set<CureMethod> getCureMethods() {
		if (cureMethods == null) {
			cureMethods = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.CureMethod>();
		}
		return cureMethods;
	}

	/**
	 */
	public CureTaskCourse() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(CureTaskCourse that) {
		setId(that.getId());
		setStep(that.getStep());
		setTime(that.getTime());
		setMemo(that.getMemo());
		setTask(that.getTask());
		setCureTaskMethods(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.CureTaskMethod>(that.getCureTaskMethods()));
		setCurePigs(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.CurePig>(that.getCurePigs()));
		setCureMethods(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.CureMethod>(that.getCureMethods()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");
		buffer.append("step=[").append(step).append("] ");
		buffer.append("time=[").append(time).append("] ");
		buffer.append("memo=[").append(memo).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof CureTaskCourse))
			return false;
		CureTaskCourse equalCheck = (CureTaskCourse) obj;
		if ((id == null && equalCheck.id != null) || (id != null && equalCheck.id == null))
			return false;
		if (id != null && !id.equals(equalCheck.id))
			return false;
		return true;
	}
}
